// pages/search/search.js
import http from '../../http/http.js'
Page({

  /**
   * 页面的初始数据
   */
  data: {
    topheight: getApp().globalData.topheight,
    searchresult:"",
    list:[],
    foucs:false
  },
  active:function(){
    this.setData({
      foucs:true
    })
  },
  unactive:function(){
    this.setData({
      foucs: false
    })
  },
  getvalue: function (e){
    let val = e.detail.value
    this.setData({
      searchresult: val
    })
    http.getdata('/api/beehive/list?deviceCode=,'+val+',').then((res)=>{
      this.setData({
        list: res.data.result.records,
      })
    })
  },
  back:function(){
    wx.navigateBack()
  },
  toinfo:function(e){
    let val = e.currentTarget.dataset.devicecode
    wx.redirectTo({
      url: '../beebox/detail/index?deviceCode='+val,
    })
  }
})